<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>参数解析器</title>
</head>

<body>
  <!-- 请补全JavaScript代码，要求将字符串参数URL中的参数解析并以对象的形式返回。
示例1
输入：

getParams('https://nowcoder.com/online?id=1&salas=1000')

输出：

{id:1, salas: 100} -->
  <script>
    const _getParams = (url) => {
      // 补全代码
      let splitUrl = url.slice(url.lastIndexOf('?') + 1).split('&')
      let obj = {}
      splitUrl.map(n => {
        let [key, value] = n.split('=')
        obj[key] = value
      })
      console.log(obj)
      return obj
    }
  </script>
</body>

</html>